package com.fjec.market.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fjec.market.entity.InfoMarketSection;
import com.fjec.market.mapper.InfoMarketSectionMapper;
import com.fjec.market.service.IInfoMarketSectionService;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 002.市场板块表 服务实现类
 * </p>
 *
 * @author admin
 * @since 2020-09-07
 */
@Service
@Transactional
public class InfoMarketSectionServiceImpl extends ServiceImpl<InfoMarketSectionMapper, InfoMarketSection> implements IInfoMarketSectionService {

    @Resource
    private InfoMarketSectionMapper mapper;

    @Override
    @Cacheable(value = "c_30", key = "'fjec:market:InfoMarketSection'")
    public List<Map<String, Object>> listOfMap() {
        List<InfoMarketSection> marketSectionList = super.list();
        List<Map<String, Object>> resultList = new ArrayList<>();
        marketSectionList.forEach(ms -> resultList.add(ms.toMap()));
        return resultList;
    }
}
